package com.v5ba;

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.pom.Navigatable;
import org.jetbrains.annotations.NotNull;

public class JumpEditAction extends AnAction {
    @Override
    public void actionPerformed(@NotNull AnActionEvent e) {
        Navigatable navigatable = e.getData(CommonDataKeys.NAVIGATABLE);
        if (navigatable != null){
            navigatable.navigate(true);
        }
    }

    @Override
    public void update(@NotNull AnActionEvent e) {
        super.update(e);
        Navigatable navigatable = e.getData(CommonDataKeys.NAVIGATABLE);
        if (navigatable == null || !navigatable.canNavigate()){
            e.getPresentation().setEnabled(false);
        }
    }
}
